package org.smartboot.flow.springboot.extension;

import org.smartboot.flow.manager.report.HttpReporter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * smart flow httReport auto config
 *
 * @author huqiang
 * @since 2022/12/15 16:32
 */
@Configuration
@ConfigurationProperties(prefix = "smart.flow.report.http")
public class FlowHttpReportConfiguration {


    private long timeout;

    private String url;

    private long idle;

    @Bean
    public HttpReporter getHttpReporter() {
        HttpReporter reporter = new HttpReporter();
        reporter.setTimeout(this.timeout);
        reporter.setUrl(this.url);
        reporter.setIdle(this.idle);
        return reporter;
    }

    public void setTimeout(long timeout) {
        this.timeout = timeout;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public void setIdle(long idle) {
        this.idle = idle;
    }
}
